home *** CD-ROM | disk | FTP | other *** search
Wrap
;CS Whiteboard ⌐ 1998 jCd. All rights reserved. ;Events on 1:start:unset %wh.* | wh.s in mode normal on 1:close:@:if ($target == $wh.a) { drawpic -c | window -c @custom | window -c $wh.a $+ ábanlist | sockclose server* | sockclose client | unset %wh.* | wh.s in mode normal | .timercx1 -m 1 300 window -c $wh.a | halt } ;Aliases alias wh.initiate { if (c-script !isin $vers) || (%wpver < 5.0) { echo $colour(info) -a *** C-Script v5.0 or higher required for this addon... Get the general version at www.21stCenturyOnline.com | halt } if ($window(-1).w < 640) || ($window(-1).h < 480) { echo $clr(info) -a *** Error starting C-Script Whiteboard: Screen resolution to small | halt } if $1 == 1 goto end | if $1 == 2 goto end2 | if $1 == 3 goto start .timer 1 1 window -r $wh.a | if %wh.init == 1 { window -noa $wh.a | halt } window -pnds +fn $wh.a 2 2 505 405 $wh.a | set %wh.init 1 :start drawrect -f $wh.a 15 1 0 0 48 385 | set %wh.count 0 | set %wh.top 3 :next inc %wh.count | if %wh.count > 16 goto rest drawx 3 %wh.top 15 15 $wh.a nofill drawrect -f $wh.a %wh.count 1 4 $calc(%wh.top + 1) 12 12 inc %wh.top 20 goto next :rest drawpic -c $wh.a 23 3 $adn $+ csboard.bmp | drawrect -f $wh.a 15 1 49 0 600 24 drawrect -f $wh.a 15 1 49 358 600 27 | drawrect -f $wh.a 15 1 495 24 27 350 wh.rgb | drawfill -sr $wh.a $wh.rgb($wh.s(out,bgcolor)) $getdot($wh.a,50,50) 50 50 drawx 53 3 72 18 $wh.a | drawx 130 3 72 18 $wh.a drawx 207 3 72 18 $wh.a | drawx 284 3 72 18 $wh.a drawx 3 363 42 14 $wh.a | drawtext $wh.a 1 arial 14 6 363 Custom wh.top $wh.s(out,mode) | drawtext $wh.a 1 arial 14 308 5 Clear drawx 480 3 13 18 $wh.a | drawtext -o $wh.a 1 arial 14 483 5 ? drawline $wh.a 14 1 49 362 125 362 | drawline $wh.a 14 1 49 362 49 378 drawline $wh.a 16 1 49 378 125 378 | drawline $wh.a 16 1 125 362 125 379 drawline $wh.a 14 1 128 362 495 362 | drawline $wh.a 14 1 128 362 128 378 drawline $wh.a 16 1 128 378 495 378 | drawline $wh.a 16 1 495 362 495 379 wh.title :end drawx 3 326 15 15 $wh.a nofill drawrect -fr $wh.a $wh.rgb($wh.s(out,color)) 1 4 327 12 12 drawx 3 344 15 15 $wh.a nofill drawrect -fr $wh.a $wh.rgb($wh.s(out,bgcolor)) 1 4 345 12 12 drawtext $wh.a $wh.s(out,fg) arial 12 20 328 fg drawtext $wh.a $wh.s(out,bg) arial 12 20 346 bg drawline $wh.a 1 1 26 298 45 298 | drawline $wh.a 1 2 26 303 45 303 drawline $wh.a 1 3 26 308 44 308 | drawline $wh.a 1 4 27 315 44 315 drawline $wh.a 12 $wh.s(out,sz) :end2 drawfill -rs $wh.a $wh.rgb(16) 12632256 $wh.s(out,tool) drawrect -f $wh.a 15 1 23 211 24 40 if $1 == $null drawx 23 $calc($gettok($wh.s(out,tool),2,32) - 3) 23 22 $wh.a nofill if $wh.s(out,type) == 7 { drawrect $wh.a $wh.s(out,nf) 1 25 213 20 5 | drawrect -f $wh.a $wh.s(out,f) 1 25 220 20 5 | drawrect -f $wh.a $wh.s(out,fb) 1 25 227 20 5 | drawrect $wh.a 1 1 25 227 20 5 } } alias -l wh.pallete { set %wh.count 0 | set %wh.top 3 :next inc %wh.count | if %wh.count > 16 goto end if $inrect($1,$2,3,%wh.top,15,15) { drawx2 3 %wh.top 15 15 $wh.a nofill .timercx -m 1 200 drawx 3 %wh.top 15 15 $wh.a nofill .timercx2 -m 1 300 drawrect -f $wh.a %wh.count 1 4 $calc(%wh.top + 1) 12 12 if ($wh.s(out,fg) == 12) { wh.s in color %wh.count | wh.csbar | wh.initiate 1 | halt } else { wh.s in bgcolor %wh.count | wh.csbar | wh.initiate 1 | halt } } | inc %wh.top 20 | goto next :end set %wh.count 0 | set %wh.top 3 :next2 inc %wh.count | if %wh.count > 8 goto end3 if $inrect($1,$2,23,%wh.top,23,24) { drawx2 23 %wh.top 23 22 $wh.a nofill .timercx -m 1 200 drawx 23 %wh.top 23 22 $wh.a nofill drawfill -rs $wh.a 12632256 $wh.rgb(16) $wh.s(out,tool) wh.s in tool 25 $calc(%wh.top + 3) | wh.s in type %wh.count | wh.initiate 2 goto end2 } | inc %wh.top 26 | goto next2 :end3 set %wh.count 0 | set %wh.top 53 :next3 inc %wh.count | if %wh.count > 4 goto end2 if $inrect($1,$2,%wh.top,3,72,18) { wh.top $wh.s(out,mode) | drawx2 %wh.top 3 72 18 $wh.a .timercx -m 1 200 drawx %wh.top 3 72 18 $wh.a nofill if %wh.count == 1 { wh.type client | halt } if %wh.count == 2 { wh.type normal | halt } if %wh.count == 3 { wh.type server | halt } if %wh.count == 4 { wh.draw drawrect -fr $wh.a $wh.rgb($wh.s(out,bgcolor)) 1 50 25 444 332 } } | inc %wh.top 77 goto next3 :end2 if $inrect($1,$2,3,363,42,14) { drawx2 3 363 42 14 $wh.a | .timercx -m 1 200 drawx 3 363 42 14 $wh.a nofill | wh.custom } if $inrect($1,$2,480,3,13,18) { drawx2 480 3 13 18 $wh.a | .timercx -m 1 200 drawx 480 3 13 18 $wh.a nofill | window -doa $wh.a $+ áHelp 3 3 400 300 | clear $wh.a $+ áhelp | loadbuf -p $wh.a $+ áHelp $adn $+ cshelp.txt | sline $wh.a $+ áHelp 17 } if $inrect($1,$2,3,326,15,15) { drawx2 3 326 15 15 $wh.a nofill | wh.s in bg 1 | wh.s in fg 12 | .timercx -m 1 200 wh.initiate 1 } if $inrect($1,$2,3,344,15,15) { drawx2 3 344 15 15 $wh.a nofill | wh.s in bg 12 | wh.s in fg 1 | .timercx -m 1 200 wh.initiate 1 } wh.csbar if $inrect($1,$2,23,211,24,23) || $inrect($1,$2,23,295,23,24) { if $inrect($1,$2,25,213,20,5) { wh.s in nf 12 | wh.s in f 14 | wh.s in fb 14 } if $inrect($1,$2,25,220,20,5) { wh.s in nf 1 | wh.s in f 12 | wh.s in fb 14 } if $inrect($1,$2,25,227,20,5) { wh.s in nf 1 | wh.s in f 14 | wh.s in fb 12 } if $inrect($1,$2,26,298,19,1) { wh.s in size 1 | wh.s in sz 1 26 298 45 298 } if $inrect($1,$2,26,303,19,1) { wh.s in size 2 | wh.s in sz 2 26 303 45 303 } if $inrect($1,$2,26,308,18,1) { wh.s in size 3 | wh.s in sz 3 26 308 44 308 } if $inrect($1,$2,27,315,17,1) { wh.s in size 4 | wh.s in sz 4 27 315 44 315 } wh.initiate 1 } set %wh.p 1 } alias -l wh.a return @Whiteboard alias -l wh.custom { window -dnoap +fn @Custom 2 2 303 135 @custom drawrect -f @custom 15 5 0 0 700 500 | drawline @Custom 14 1 5 50 262 50 drawline @Custom 14 1 5 75 262 75 | drawline @Custom 14 1 5 100 262 100 drawline @Custom 16 1 5 51 262 51 | drawline @Custom 16 1 5 76 262 76 drawline @Custom 16 1 5 101 262 101 | drawline @Custom 14 1 124 5 124 26 drawline @Custom 14 1 124 4 151 4 | drawline @Custom 16 1 124 26 151 26 drawline @Custom 16 1 151 4 151 27 | wh.csbar | window -r @custom } alias -l wh.csbar { if $window(@custom).state != $null { if $wh.s(out,fg) == 12 { set %wh.bgfg color } if $wh.s(out,bg) == 12 { set %wh.bgfg bgcolor } set %wh.rgb $rgb($wh.rgb($wh.s(out,%wh.bgfg))) drawrect -nf @custom 15 5 266 39 25 110 | drawrect -nf @custom 15 5 5 39 261 10 drawrect -nf @custom 15 5 5 64 261 10 | drawrect -nf @custom 15 5 5 89 261 10 drawtext -n @custom 1 arial 12 266 42 $gettok(%wh.rgb,1,44) R drawtext -n @custom 1 arial 12 266 67 $gettok(%wh.rgb,2,44) G drawtext -n @custom 1 arial 12 266 92 $gettok(%wh.rgb,3,44) B drawline -n @custom 1 2 $calc($gettok(%wh.rgb,1,44) + 6) 40 $calc($gettok(%wh.rgb,1,44) + 6) 48 drawline -n @custom 1 2 $calc($gettok(%wh.rgb,2,44) + 6) 65 $calc($gettok(%wh.rgb,2,44) + 6) 73 drawline -n @custom 1 2 $calc($gettok(%wh.rgb,3,44) + 6) 90 $calc($gettok(%wh.rgb,3,44) + 6) 98 drawrect -nrf @custom $wh.rgb($wh.s(out,%wh.bgfg)) 5 125 5 25 20 | drawline @custom } } alias -l wh.rgb { if $1 == 1 return 0 | if $1 == 2 return 8388608 | if $1 == 3 return 32768 if $1 == 4 return 255 | if $1 == 5 return 128 if $1 == 6 return 8388736 | if $1 == 7 return 32764 if $1 == 8 return 65535 | if $1 == 9 return 65280 if $1 == 10 return 8421376 | if $1 == 11 return 16776960 if $1 == 12 return 16711680 | if $1 == 13 return 16711935 if $1 == 14 return 8421504 | if $1 == 15 return 12632256 if $1 == 16 return 16777215 | if $1 != $null return $1- drawline $wh.a 14 1 49 358 496 358 | drawline $wh.a 14 1 495 24 495 358 drawline $wh.a 14 1 49 24 49 358 | drawline $wh.a 14 1 49 24 495 24 } alias -l wh.s { if $1 == out return $readini $adn $+ csboard.ini settings $2 if $1 == in writeini $adn $+ csboard.ini settings $2- if $1 == rem remini $adn $+ csboard.ini settings $2- } alias -l wh.type { if $1 isnum { if $1 == 3 && ($wh.s(out,mode) == server || $wh.s(out,mode) == client) { return $2- } if $wh.s(out,mode) == server { if $1 == 4 && $sline($wh.a,0) != 0 && $sline($wh.a,1).ln != 1 { return $2- } if $1 == 5 return $2- | if $1 == 6 && $sock(server).ip != $null { return $2- } } return } sockclose server* | sockclose client | unset %wh.* if s isin $1 || c isin $1 { if $1 == server { :start set %wh.port $$?="Enter a port number:" if $portfree(%wh.port) && %wh.port != 80 && %wh.port isnum && %wh.port !isnum 6660-7000 && %wh.port != 21 && %wh.port != 110 { socklisten server %wh.port | wh.notice Now listening for incoming requests on %wh.port | set %wh.nick 1@ $+ $ip | set %wh.names 1@ $+ $ip $+ , } else { wh.notice %wh.port is not available/valid... Try again | goto start } wh.s in mode server } if $1 == client { :start2 set %wh.port $$?="Enter a port number:" if %wh.port == 80 || %wh.port !isnum || %wh.port isnum 6660-7000 || %wh.port == 21 || %wh.port == 110 { wh.notice %wh.port is not available/valid... Try again | goto start2 } set %wh.addy $$?="Enter an address:" wh.notice Initiating connection with %wh.addy on port %wh.port wh.s in mode client | sockopen client $gettok(%wh.addy,1,32) %wh.port } window -c $wh.a | window -pndsl11 +fn $wh.a 2 2 635 405 $wh.a comic sans ms 12 | wh.initiate 3 | .timer 1 1 window -r $wh.a } if $1 == normal { wh.s in mode normal | window -c $wh.a | unset %wh.* | wh.initiate | halt } wh.names } alias -l wh.top { if $1 == normal { drawtext $wh.a 1 arial 14 210 5 Server Mode.. drawtext $wh.a 1 arial 14 57 5 Client Mode... drawtext $wh.a 14 arial 14 135 5 Normal Mode if %wh.count == 2 { beep | halt } } if $1 == server { drawtext $wh.a 14 arial 14 210 5 Server Mode.. drawtext $wh.a 1 arial 14 57 5 Client Mode... drawtext $wh.a 1 arial 14 135 5 Normal Mode if %wh.count == 3 { beep | halt } } if $1 == client { drawtext $wh.a 1 arial 14 210 5 Server Mode.. drawtext $wh.a 14 arial 14 57 5 Client Mode... drawtext $wh.a 1 arial 14 135 5 Normal Mode if %wh.count == 1 { beep | halt } } } alias -l wh.title drawrect -f $wh.a 15 1 52 365 70 11 | drawtext $wh.a 1 arial 14 52 363 Mode: $wh.s(out,mode) alias -l wh.send { if $wh.s(out,mode) == server && $sock(server*,0) > 0 sockwrite -tn server* draw $wh.code $1- elseif $sock(client*,0) > 0 sockwrite -tn client* draw $wh.s(out,rand) $1- $1- } alias -l wh.code { set %wh.rand $wh.s(out,rand) if %wh.rand != $null && draw !isin %wh.rand && wh. !isin %wh.rand { wh.s rem rand | return %wh.rand } else return server } alias -l wh.send2 if $sock(server*,0) > 0 sockwrite -tn server* $1- alias -l wh.send3 if $sock(client*,0) > 0 sockwrite -tn client $1- alias -l wh.info wh.notice $1- | wh.send2 info $1- alias -l wh.draw if draw* iswm $1 wh.send $1- alias -l wh.notice drawrect -f $wh.a 15 1 131 365 363 11 | drawtext $wh.a 1 arial 14 132 363 $mid($1-,1,60) $+ ... ;Sends current list of users alias -l wh.names { if $wh.s(out,mode) == client || $wh.s(out,mode) == server { clear -l $wh.a | set %wh.count 0 | if $1- != $null { set %wh.names $1- } :next inc %wh.count | if $gettok(%wh.names,%wh.count,44) == $null goto end aline -l $wh.a $mid($gettok(%wh.names,%wh.count,44),2,999) | goto next :end } } alias -l wh.del set %wh.names $remtok(%wh.names,$1,1,44) $+ , | wh.names | wh.send2 names %wh.names | wh.send2 quit $1 $1 alias -l wh.nick { :top set %wh.nick $$?="Enter a new nick (max 8 chars):" | if %wh.nick == $null goto top set %wh.nick $mid($gettok(%wh.nick,1,32),1,8) | wh.send3 nick %wh.nick | if $sock(server*,0) > 0 && $wh.nck(%wh.nick) == $null { wh.info $mid($gettok(%wh.names,1,44),3,999) is now known as %wh.nick ( $+ $ip $+ ) | set %wh.nick 1@ $+ %wh.nick | set %wh.names $reptok(%wh.names,$gettok(%wh.names,1,44),%wh.nick,1,44) $+ , | wh.send2 names %wh.names | wh.names } } alias -l wh.nck { set %wh.count 0 :next inc %wh.count | if $gettok(%wh.names,%wh.count,44) == $null return if $mid($gettok(%wh.names,%wh.count,44),3,999) == $1- && %wh.count == 1 return 1 if $mid($gettok(%wh.names,%wh.count,44),2,999) == $1- return 1 | goto next } alias -l wh.kick { if $sline($wh.a,0) == 0 || $sline($wh.a,1).ln == 1 { halt } set %wh.reason $?="Reason:" if %wh.reason != $null { set %wh.reason ( $+ %wh.reason $+ ) } wh.info $sline($wh.a,1) was kicked from the server %wh.reason sockclose server $+ $wh.getnum($sline($wh.a,1)) wh.del $wh.getnum($sline($wh.a,1)) $+ $sline($wh.a,1) } alias -l wh.bndel { set %wh.line $sline(@whiteboardábanlist,1).ln if %wh.line == $null halt remini $adn $+ csboard.ini settings %wh.line set %wh.num 0 | set %wh.num2 $readini -n $adn $+ csboard.ini settings num | set %wh.num3 %wh.num2 set %wh.count 0 | set %wh.num 0 :next inc %wh.num | if %wh.num > %wh.num2 goto end set %wh.read $readini -n $adn $+ csboard.ini settings %wh.num | if (%wh.read == $null) { inc %wh.count | goto next } if %wh.count != 0 { set %wh.recno $calc(%wh.num - %wh.count) | writeini $adn $+ csboard.ini settings %wh.recno $readini -n $adn $+ csboard.ini settings %wh.num | remini $adn $+ csboard.ini settings %wh.num } goto next :end writeini $adn $+ csboard.ini settings num $calc(%wh.num3 - 1) | wh.banlist } alias -l wh.getnum { set %wh.count2 0 :next inc %wh.count2 | if $gettok(%wh.names,%wh.count2,44) == $null return if $mid($gettok(%wh.names,%wh.count2,44),2,999) == $1 return $mid($gettok(%wh.names,%wh.count2,44),1,1) goto next } alias -l wh.ban { set %wh.count 0 :next inc %wh.count | if %wh.count > $wh.s(out,num) return if $wh.s(out,%wh.count) iswm $1 return 1 | goto next } alias -l wh.ban2 { set %wh.num $wh.s(out,num) | if %wh.num == $null { set %wh.num 0 } inc %wh.num | set %wh.ban server $+ $getnum($sline($wh.a,1)) set %wh.ban $sock(%wh.ban).ip | wh.info %wh.ban has been banned from the server wh.s in %wh.num %wh.ban | wh.s in num %wh.num } alias -l wh.banlist { clear $wh.a $+ áBanlist | set %wh.count 0 | window -dnoal $wh.a $+ áBanlist 3 3 300 300 $wh.a $+ ábanlist comic sans ms 12 | window -r $wh.a $+ ábanlist :next inc %wh.count | if %wh.count > $wh.s(out,num) return rline $wh.a $+ ábanlist %wh.count $wh.s(out,%wh.count) | goto next } alias -l wh.clone { set %wh.count 0 :next inc %wh.count | if $gettok(%wh.names,%wh.count,44) == $null return set %wh.addy2 server $+ $mid($gettok(%wh.names,%wh.count,44),1,1) if $sock(%wh.addy2).ip == $1 return 1 | goto next } ;Menus menu @custom { mouse { if $mouse.key == 1 && %wh.cust != $null { set %wh.x $calc($mouse.x - 5) if %wh.x < 0 { set %wh.x 0 } if %wh.x > 255 { set %wh.x 255 } if %wh.cust == 1 { set %wh.rgb %wh.x $+ , $+ $gettok(%wh.rgb,2,44) $+ , $+ $gettok(%wh.rgb,3,44) } if %wh.cust == 2 { set %wh.rgb $gettok(%wh.rgb,1,44) $+ , $+ %wh.x $+ , $+ $gettok(%wh.rgb,3,44) } if %wh.cust == 3 { set %wh.rgb $gettok(%wh.rgb,1,44) $+ , $+ $gettok(%wh.rgb,2,44) $+ , $+ %wh.x } wh.s in %wh.bgfg $rgb( [ %wh.rgb ] ) | wh.csbar } } sclick { if $inrect($mouse.x,$mouse.y,$calc($gettok(%wh.rgb,1,44) + 5),40,2,8) { set %wh.cust 1 } if $inrect($mouse.x,$mouse.y,$calc($gettok(%wh.rgb,2,44) + 5),65,2,8) { set %wh.cust 2 } if $inrect($mouse.x,$mouse.y,$calc($gettok(%wh.rgb,3,44) + 5),90,2,8) { set %wh.cust 3 } } dclick unset %wh.cust drop { unset %wh.cust | wh.initiate 1 } } menu @whiteboard { mouse { if $mouse.key == 1 { if %wh.p != $null halt if $inrect($mouse.x,$mouse.y,0,0,55,385) || $inrect($mouse.x,$mouse.y,49,0,600,30) || $inrect($mouse.x,$mouse.y,49,353,600,27) || $inrect($mouse.x,$mouse.y,490,24,27,350) { halt } if $wh.s(out,type) == 1 { wh.draw drawline -rh $wh.a $wh.rgb($wh.s(out,color)) $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $mouse.x $mouse.y wh.s in x $mouse.x | wh.s in y $mouse.y } if $wh.s(out,type) == 2 { if $wh.s(out,x) != $null { drawline -i $wh.a 1 $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $wh.s(out,lx) $wh.s(out,ly) drawline -i $wh.a 1 $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $mouse.x $mouse.y wh.s in lx $mouse.x | wh.s in ly $mouse.y } } if $wh.s(out,type) == 3 { wh.draw drawdot -rh $wh.a $wh.rgb($wh.s(out,color)) $wh.s(out,size)) $mouse.x $mouse.y } if $wh.s(out,type) == 6 { drawrect -ie $wh.a 1 4 $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) drawrect -ie $wh.a 1 4 $wh.s(out,x) $wh.s(out,y) $calc($mouse.x - $wh.s(out,x)) $calc($mouse.y - $wh.s(out,y)) wh.s in lx $mouse.x | wh.s in ly $mouse.y } if $wh.s(out,type) == 7 { drawrect -i $wh.a 1 $calc($wh.s(out,size) + 1) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) drawrect -i $wh.a 1 $calc($wh.s(out,size) + 1) $wh.s(out,x) $wh.s(out,y) $calc($mouse.x - $wh.s(out,x)) $calc($mouse.y - $wh.s(out,y)) wh.s in lx $mouse.x | wh.s in ly $mouse.y } if $wh.s(out,type) == 8 { wh.draw drawline -rh $wh.a [ $wh.rgb($wh.s(out,bgcolor)) ] $calc($wh.s(out,size) * 3) $wh.s(out,x) $wh.s(out,y) $mouse.x $mouse.y wh.s in x $mouse.x | wh.s in y $mouse.y } } elseif $mouse.key != 1 { if %wh.p != $nulll { wh.s rem x | unset %wh.p | halt } if $wh.s(out,type) == 2 && $wh.s(out,x) != $null { wh.draw drawline -r $wh.a $wh.rgb($wh.s(out,color)) $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $wh.s(out,lx) $wh.s(out,ly) | wh.s rem x } if $wh.s(out,type) == 6 && $wh.s(out,x) != $null { wh.draw drawrect -re $wh.a $wh.rgb($wh.s(out,bgcolor)) $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) | wh.s rem x } if $wh.s(out,type) == 7 && $wh.s(out,x) != $null { if $wh.s(out,nf) == 12 { wh.draw drawrect -rh $wh.a $wh.rgb($wh.s(out,color)) $calc($wh.s(out,size) + 1) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) } if $wh.s(out,f) == 12 { wh.draw drawrect -rhf $wh.a $wh.rgb($wh.s(out,bgcolor)) $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) } if $wh.s(out,fb) == 12 { wh.draw drawrect -rhf $wh.a $wh.rgb($wh.s(out,bgcolor)) $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) | wh.draw drawrect -r $wh.a $wh.rgb($wh.s(out,color)) $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) } wh.s rem x } } } sclick { if %wh.p != $null halt if $inrect($mouse.x,$mouse.y,49,353,600,27) || $inrect($mouse.x,$mouse.y,490,24,27,350) { halt } if $inrect($mouse.x,$mouse.y,0,0,55,385) || $inrect($mouse.x,$mouse.y,49,0,600,30) { wh.pallete $mouse.x $mouse.y | wh.s in x 51 | wh.s in y $mouse.y | halt } if $wh.s(out,type) == 1 { wh.draw drawline -hr $wh.a $wh.rgb($wh.s(out,color)) $wh.s(out,size) $mouse.x $mouse.y $mouse.x $mouse.y wh.s in x $mouse.x | wh.s in y $mouse.y } if $wh.s(out,type) == 2 { wh.s in x $mouse.x | wh.s in y $mouse.y | wh.s in lx $mouse.x | wh.s in ly $mouse.y drawline -i $wh.a 1 $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $wh.s(out,lx) $wh.s(out,ly) } if $wh.s(out,type) == 3 { wh.draw drawdot -rh $wh.a $wh.rgb($wh.s(out,color)) $wh.s(out,size) $mouse.x $mouse.y } if $wh.s(out,type) == 4 { wh.draw drawtext -rcho $wh.a $wh.rgb($wh.s(out,color)) arial $calc($wh.s(out,size) * 10) $mouse.x $mouse.y $calc(495 - $mouse.x) $calc(358 - $mouse.y) $$?="Enter text here:" } if $wh.s(out,type) == 5 { wh.draw drawfill -rs $wh.a $wh.rgb($wh.s(out,bgcolor)) $getdot($wh.a,$mouse.x,$mouse.y) $mouse.x $mouse.y | wh.rgb } if $wh.s(out,type) == 6 { wh.s in x $mouse.x | wh.s in y $mouse.y | wh.s in lx $mouse.x | wh.s in ly $mouse.y drawrect -ie $wh.a 1 $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) } if $wh.s(out,type) == 7 { wh.s in x $mouse.x | wh.s in y $mouse.y | wh.s in lx $mouse.x | wh.s in ly $mouse.y drawrect -i $wh.a 1 $calc($wh.s(out,size) + 1) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) } if $wh.s(out,type) == 8 { wh.draw drawline -rh $wh.a $wh.rgb($wh.s(out,bgcolor)) $calc($wh.s(out,size) * 3) $mouse.x $mouse.y $mouse.x $mouse.y wh.s in x $mouse.x | wh.s in y $mouse.y } } drop { if %wh.p != $null halt if $wh.s(out,type) == 2 { drawline -i $wh.a 1 $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $wh.s(out,lx) $wh.s(out,ly) wh.draw drawline -rh $wh.a $wh.rgb($wh.s(out,color)) $wh.s(out,size) $wh.s(out,lx) $wh.s(out,ly) $wh.s(out,x) $wh.s(out,y) wh.s rem x } if $wh.s(out,type) == 6 { drawrect -ie $wh.a 1 $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) wh.draw drawrect -rhe $wh.a $wh.rgb($wh.s(out,bgcolor)) $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) wh.s rem x } if $wh.s(out,type) == 7 { if $wh.s(out,nf) == 12 { wh.draw drawrect -rh $wh.a $wh.rgb($wh.s(out,color)) $calc($wh.s(out,size) + 1) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) } if $wh.s(out,f) == 12 { wh.draw drawrect -rhf $wh.a $wh.rgb($wh.s(out,bgcolor)) $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) } if $wh.s(out,fb) == 12 { wh.draw drawrect -rhf $wh.a $wh.rgb($wh.s(out,bgcolor)) $calc($wh.s(out,size) + 1)) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) | wh.draw drawrect -r $wh.a $wh.rgb($wh.s(out,color)) $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) } wh.s rem x } } $wh.type(4,Ban):wh.ban2 $wh.type(4,Kick...):wh.kick $wh.type(4,Ban + Kick...):wh.ban2 | wh.kick $wh.type(5,Banlist):wh.banlist - $wh.type(3,Change nick...):wh.nick $wh.type(6,Change topic...):wh.s in topic $$?="Enter a new topic:" | titlebar $wh.a $chr(91) $+ Topic: $! $+ $chr(93) | wh.send2 topic $! } menu @whiteboardábanlist { dclick { wh.bndel } Delete:wh.bndel } ;Socket events on 1:sockopen:client:if $sockerr > 0 { .timer 1 3 wh.notice Connection lost... Back to normal mode | wh.type normal | return } | wh.notice Connection established... Logging on | wh.s in rand $rand(a,z) $+ $rand(A,Z) $+ $rand(0,9) $+ $rand(0,9) on 1:sockread:client { if $sockerr > 0 { .timer 1 3 wh.notice Connection lost... Back to normal mode | wh.type normal | return } sockread %wh.read if $gettok(%wh.read,1,32) == info wh.notice $gettok(%wh.read,2-,32) if $gettok(%wh.read,1,32) == topic && $gettok(%wh.read,2-,32) != $wh.s(out,topic) { wh.s in topic $gettok(%wh.read,2-,32) | titlebar $wh.a $chr(91) $+ Topic: $gettok(%wh.read,2-,32) $+ $chr(93) | wh.notice Topic changed to ' $+ $gettok(%wh.read,2-,32) $+ ' } if $gettok(%wh.read,1,32) == names wh.names $gettok(%wh.read,2-,32) if $gettok(%wh.read,1,32) == draw && $gettok(%wh.read,2,32) != $wh.s(out,rand) && draw* iswm $gettok(%wh.read,3,32) $gettok(%wh.read,3-,32) } on 1:sockclose:client:.timer 1 3 wh.notice Connection lost... Back to normal mode | wh.type normal on 1:socklisten:server { if $sockerr > 0 return | if %wh.server == $null { set %wh.server 1 } inc %wh.server | sockaccept server [ $+ [ %wh.server ] ] | wh.s rem rand | set %wh.addy server [ $+ [ %wh.server ] ] if $wh.clone($sock(%wh.addy).ip) != $null && $sock(%wh.addy).ip != $ip { sockwrite -tn %wh.addy info No clones allowed on $ip | sockclose %wh.addy | halt } if $wh.ban($sock(%wh.addy).ip) != $null { sockwrite -tn %wh.addy info Your address is banned from $ip | sockclose %wh.addy | halt } sockmark %wh.addy %wh.server $+ $sock(%wh.addy).ip | set %wh.names %wh.names $+ %wh.server $+ $sock(%wh.addy).ip $+ , | wh.send2 topic $wh.s(out,topic) | wh.send2 names %wh.names | wh.names wh.info $mid($sock(%wh.addy).mark,2,999) ( $+ $sock(%wh.addy).ip $+ ) has joined } on 1:sockread:server* { if $sockerr > 0 { .timer 1 3 wh.del $sock($sockname).mark | wh.info Connection lost from $mid($sock($sockname).mark,2,999) ( $+ $sock($sockname).ip $+ ) | return } sockread %wh.read if $gettok(%wh.read,1,32) == nick && $wh.nck($mid($gettok(%wh.read,2,32),1,8)) == $null { set %wh.old $sock($sockname).mark | sockmark $sockname $right($sockname,1) $+ $mid($gettok(%wh.read,2,32),1,8) | set %wh.names %wh.names $+ $sock($sockname).mark $+ , | wh.del %wh.old | wh.info $mid(%wh.old,2,999) is now known as $mid($sock($sockname).mark,2,999) ( $+ $sock($sockname).ip $+ ) } if $gettok(%wh.read,1,32) == draw { wh.s in rand $gettok(%wh.read,2,32) | wh.draw $gettok(%wh.read,3-,32) } } on 1:sockclose:server*:.timer 1 3 wh.del $sock($sockname).mark | wh.info Connection lost from $mid($sock($sockname).mark,2,999) ( $+ $sock($sockname).ip $+ )